<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ taglib prefix="limits" uri="/WEB-INF/tld/limits.tld"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>角色</title>
<link rel="stylesheet" type="text/css"	href="../static/js/themes/defalut.css">
<link rel="stylesheet" type="text/css"	href="../static/js/themes/public.css">
<link rel="stylesheet" type="text/css"	href="../static/js/themes/ddspstyle.css">
<link rel="stylesheet" type="text/css"	href="../static/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"	href="../static/js/themes/icon.css">
<link href="../static/css/uploadify.css" rel="stylesheet" type="text/css"/>

<script type="text/javascript" src="../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../static/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../static/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../static/js/index.js"></script>
<script src="../static/js/jquery.uploadify.js" type="text/javascript"></script>
<script type="text/javascript">
		var queryParams;
		function EasyuiDatagrid() {
			$("#easyui-datagrid").datagrid({
				url: '../content/content_list.do',
				nowrap: true,
				striped: true,
				border: false,
				fit: true,
				rownumbers:true,
				queryParams: getGueryParams(),
				columns: [[
					{field:'f_cc_id',title:'模板ID',align:'center',width:50},
					{field:'f_cc_name',title:'模板名称',align:'center',width:250},
					{field:'f_cc_status',title:'模板状态',align:'center',width:80,
						formatter:function(value,row,index) {
							var status = "未知";
							if(value==1){
								status="上线";
							} else if(value==2||value==16||value==14){
								status="待审核";
							} else if(value==4||value==13||value==15){
								status="审核未通过";
							}else if(value==5){
								status="待转码";
							}else if(value==6){
								status="正在转码";
							}else if(value==7){
								status="转码失败";
							}else if(value==8){
								status="等待资源";
							}else if(value==9){
								status="资源缺失";
							}else if(value==10){
								status="资源格式容量不正确";
							}else if(value==11){
								status="待处理";
							}else if(value==12){
								status="不通过";
							}else if(value==17){
								status="等待传输";
							}else if(value==18){
								status="传输失败";
							}else if(value==19){
								status="传输中";
							}else if(value==20){
								status="等待删除";
							}
							return status;
						}	
					},
					{field:'f_cc_type',title:'模板类型',align:'center',width:60,
						formatter:function(value,row,index) {
							var status = "模板";
							return status;
						}	
					}
				]],
				singleSelect:true,
				pagination:true,
				pageList:[10,20,30,40,50],
				pageSize:10,
				toolbar: '#toolbar',
				onExpandRow: function(index,row){
					
				},
				onSelect: function(rowIndex,rowData) {
					
				},
				onUnselect: function(rowIndex,rowData) {
					
				},
				onCheckAll: function(rowIndex,rowData) {
					
				},
				onUncheckAll: function(rowIndex,rowData) {
				
				},
				onLoadSuccess: function(data) {
					if(data.total==-1) {
						$.messager.defaults={ok:"确定",cancel:"取消"};
						$.messager.confirm('提示', '用户尚未登录,请登录', function(r){
						if (r){
						    window.parent.location.href='/login.do';
						    return false;
						}});
					}
				}
			});
		}
		
		function getGueryParams(){
			return {
				f_cc_name:$("#f_cc_name").val(),
				f_cc_status:$("#f_cc_status").val(),
				f_cc_type:20
			};
		}
		$(function(){
			new EasyuiDatagrid();
			gotoSearch = function(){
				$("#easyui-datagrid").datagrid('reload',getGueryParams());
			};
			
		});
		function updatemodel(){
			var rowInfo = $("#easyui-datagrid").datagrid('getSelected');
			if(rowInfo==null){
				$.messager.alert('提示', "您未选择模板", 'info', function() {
					$.messager.progress('close');
				});
				return;	
			}
			window.parent.document.getElementById("f_po_model_name").value=rowInfo.f_cc_name;
			 window.parent.document.getElementById("f_po_model").value=rowInfo.f_cc_id;
	         //window.parent.document.getElementById("model_list").style.display="none";
	         parent.$('#model_list').dialog('close')
		}
		function onpress(){
			var event=arguments.callee.caller.arguments[0]||window.event;//消除浏览器差异
	   		  	if (event.keyCode == 13){  
	      			gotoSearch($('#easyui-treegrid'));
	    		}
		}
</script>
</head>
<body>
	<input type="hidden" id="sessionId" value="${pageContext.session.id}" />
	<table id="easyui-datagrid" title="模板列表"></table>
	<div id="toolbar" class="easyui_datagrid_toolbar" style="">
		<div class="easyuiSearch">
			<form onsubmit="return false;" method="post">
				<table cellspacing="0" cellpadding="0" width="90%">
					<tr>
						<td align="left" width="20%">模板名称：</td>
						<td align="left" width="15%"><input name="f_cc_name" id="f_cc_name" style="width: 150px;"  onkeydown="onpress();"/></td>
						<td align="left" width="2%"></td>
						<td align="left" width="6%"><select id="f_cc_status" name="f_cc_status">
									<option value="0">请选择</option>
									<option value="1">上线</option>
									<option value="16">审核中</option>
							</select></td>
						<td align="left" width="15%">
							<limits:uiAuth url="content_list.do">
								<a href="javascript:void(0);" class="easyui-linkbutton"
									data-options="iconCls:'icon-search', plain:true"
									onclick="gotoSearch($('#easyui-datagrid'))">查询</a>
							</limits:uiAuth>
						</td>
						<td align="right" width="15%">
							<a id="easyui-linkbutton" class="easyui-linkbutton"
							data-options="iconCls:'icon-ok'" href="javascript:void(0);"
							onclick="updatemodel()">确认</a>
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
</div>		
</body>
</html>